package edu.xidian.pnaWeb.web.contorller;

import edu.xidian.pnaWeb.web.common.Constant;
import edu.xidian.pnaWeb.web.model.AdminContext;
import edu.xidian.pnaWeb.web.model.Response;
import edu.xidian.pnaWeb.web.model.LoginInfo;
import edu.xidian.pnaWeb.web.service.api.AdminService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * @Description
 * @Author He
 * @Date 2021/10/17 15:56
 */
@RestController
public class AdminController {
//	@Resource
//	private AdminService adminService;
	/**
	 * 登录
	 */
	@PostMapping("/login")
	public Response login(@RequestBody LoginInfo info, HttpSession session) {
//		if (adminService.login(info)) {
//			session.setAttribute(Constant.LOGIN_USER,new AdminContext());
//			return Response.success();
//		}
//		return Response.error("登陆失败");
		return null;
	}

	/**
	 * 退出
	 */
	@PostMapping("/logout")
	public Response logout(HttpSession session) {
		session.invalidate();
		return Response.success();
	}
}

